package com.kzj.laimeimei.recyclerCard.cardView;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.util.AttributeSet;

import com.ab.util.AbViewUtil;
import com.kzj.laimeimei.R;
import com.kzj.laimeimei.global.App;
import com.kzj.laimeimei.recyclerCard.basic.CardItemView;
import com.kzj.laimeimei.recyclerCard.basic.MaterialListView;
import com.kzj.laimeimei.recyclerCard.card.service.ServiceMaterilistViewProduct;
import com.kzj.laimeimei.recyclerCard.card.service.ServiceProductCard;

/**
 * Created by xyg on 2015/10/26.
 */
public class ServiceMaterilistViewProductCardView extends CardItemView<ServiceMaterilistViewProduct> {

    private Context context;
    private MaterialListView material_listview;
  //  private CirclePageIndicator circlePageIndicator;
    public ServiceMaterilistViewProductCardView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public ServiceMaterilistViewProductCardView(Context context) {
        super(context);
        this.context = context;
    }

    public ServiceMaterilistViewProductCardView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }

    @Override
    public void build(ServiceMaterilistViewProduct card) {
        super.build(card);
        material_listview=(MaterialListView)findViewById(R.id.material_listview);
        AbViewUtil.scaleView(material_listview);
        material_listview.getLayoutParams().height= AbViewUtil.scaleValue(context,200);
        material_listview.getLayoutParams().width= App.getInstance().screenWidth;
        material_listview.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
       // RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) material_listview.getLayoutParams();
       // layoutParams.setMargins();
        initData();
        setNeedScale(false);
    }
    private void initData()
    {
        for (int j=0;j<6;j++)
        {
            ServiceProductCard serviceProductCard=new ServiceProductCard(context);
            material_listview.add(serviceProductCard);
        }
    }
}
